<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商家管理控制台</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath}/images/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/identify.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/layout.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/account.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/control_index.css" />
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/haidao.offcial.general.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/select.js"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/haidao.validate.js"></script>
</head>
<body>
   <div class="view-topbar">
			<div class="topbar-console">
				<div class="tobar-head fl">
					<a href="#" class="topbar-logo fl">
					<span><img src="${pageContext.request.contextPath}/images/logo.png" width="20" height="20"/></span>
					</a>
					<a href="${pageContext.request.contextPath}/pages/index.jsp" class="topbar-home-link topbar-btn text-center fl"><span>商户管理控制台</span></a>
				</div>
			</div>
			<div class="topbar-info">
				<ul class="fr">
					<li class="fl topbar-info-item">
					<div class="dropdown">
						<a href="#" class="topbar-btn">
						<span class="fl text-normal">${sessionScope.saleAccount.saleAccount }</span>
						<span class="icon-arrow-down"></span>
						</a>
						<ul class="dropdown-menu">
							<li><li><a href="${pageContext.request.contextPath}/saleAccount/logout">注销</a></li>
						</ul>
					</div>
					</li>
				</ul>
			</div>
		</div>
		<div class="view-body">
			<div class="view-sidebar">
				<div class="sidebar-content">
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">权限申请</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/sale/infoShow">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_message.png" width="16" height="16" /></b>
								<span class="text-normal">申请入驻</span>
							</a>
						</li>
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">商品中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
							<li>
								<a href="${pageContext.request.contextPath}/goods/goods">
									<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_author.png" width="16" height="16" /></b>
									<span class="text-normal">商品管理</span>
								</a>
							</li>
						<ul class="sidebar-trans">
							<li>
								<a href="${pageContext.request.contextPath}/goods/toAdd">
									<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_author.png" width="16" height="16" /></b>
									<span class="text-normal">商品添加</span>
								</a>
							</li>
							
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">个人中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/saleInfo/getSaleInfo">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_order.png" width="16" height="16" /></b>
								<span class="text-normal">个人信息</span>
							</a>
						</li>
						
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">子账号中心</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/babyAccount/newQuery">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_cost.png" width="16" height="16" /></b>
								<span class="text-normal">子账号查询</span>
							</a>
						</li>
						<li>
							<a href="${pageContext.request.contextPath}/babyAccount/toAdd">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_cost.png" width="16" height="16" /></b>
								<span class="text-normal">子账号添加</span>
							</a>
						</li>
						</ul>
					</div>
					<div class="sidebar-nav">
						<div class="sidebar-title">
							<a href="#">
								<span class="icon"><b class="fl icon-arrow-down"></b></span>
								<span class="text-normal">订单管理</span>
							</a>
						</div>
						<ul class="sidebar-trans">
						<li>
							<a href="${pageContext.request.contextPath}/saleOrder/saleOrderList">
								<b class="sidebar-icon"><img src="${pageContext.request.contextPath}/images/icon_gold.png" width="16" height="16" /></b>
								<span class="text-normal">订单查询</span>
							</a>
						</li>
						</ul>
					</div>
				</div>
			</div>
		  
		
		
	
		<div class="view-product">
				<div class="company_identify">
					<div class="manage-head">
					<h6 class="padding-left manage-head-con">添加商品信息</h6>
					</div>
					<form  action="${pageContext.request.contextPath}/goods/insert" method="post" id="in" autocomplete="off"
					name="form1" onSubmit="return myCheck()">
						<div class="basic-info-detail clearfix">
							<div class="unit-style padding-big-lr clearfix">
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										手机名称:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="goodsName" id="goodsName" value=""
										 placeholder="请输入手机名称">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										手机版本:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="version" value=""
										id="version" placeholder="请输入手机版本">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										屏幕大小:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="screenSize" value=""
										id="screen"placeholder="请输入屏幕大小">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										ROM:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="rom" value=""
										id="rom" placeholder="请输入ROM">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										RAM:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="ram" value=""
										 id="ram" placeholder="请输入RAM">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										手机分辨率:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="prices" value=""
										id="reso" placeholder="请输入ROM">
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										上市年份:
									</p>
									<div class="content-right-zoon">
										<input class=" laydate-icon width-main input" type="text" datatype="*" name="timeMarket" value=""
										 id="tm" placeholder="请输入上市年份">
									</div>
								</div>
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										图片名称:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="icon" value=""
										 id="tm" placeholder="请输入图片名称">
									</div>
								</div>
						   </div>
						
						
						<div class="unit-style padding-large-tb clearfix">
							<div class="margin-large-top padding-left text-left content-right-zoon">
								<input type="submit" value="提交" class="submit fl" onclick="addForm()">
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		  
		
		
	
		<div class="view-product">
				<div class="company_identify">
					<div class="manage-head">
					<h6 class="padding-left manage-head-con">申请入驻</h6>
					</div>
					<form name="myform" action=" " method="post" id="in" autocomplete="off" onSubmit="formsub()">
						<div class="basic-info-detail clearfix">
							<div class="unit-style padding-big-lr clearfix">
							    <input type="hidden" name="id" value="${settle.id}" id="id">
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										 证件类型:
									</p>
									<div class="content-right-zoon">
										<%-- <input class="width-main input" type="text" datatype="*" name="cardType" id="cardType" value="${settle.cardType}"> --%>
										<select name="cardType" id="cardType">
										  <option value="普通营业执照" <c:if test="${'普通营业执照' eq settle.cardType}">selected</c:if>  >普通营业执照</option>
										  <option value="多证合一营业执照" <c:if test="${'多证合一营业执照' eq settle.cardType }">selected</c:if> >多证合一营业执照</option>
										</select>
									</div>
								</div>
										
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										单位所在地:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="district" value="${settle.district}"
										id="district" >
									</div>
								</div>				
								
								<div class="real-name-con  margin-top-25 clearfix">
									<p class="content-left-zoon">
										经营范围:
									</p>
									<div class="content-right-zoon">
										<textarea class="width-main height-large border-grey-around textarea" 
										type="text" datatype="*" name="saleType" id="saleType" >${settle.saleType}</textarea>
									</div>
								</div>
							  <div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										店铺名称:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="storeName" value="${settle.storeName}"
										 id="storeName" >
									</div>
								</div>
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										店主姓名:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="saleName" value="${settle.saleName}"
										id="saleName" >
									</div>
								</div>
								
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										身份证号:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="saleIdcard" value="${settle.saleIdcard }"
										 id="saleIdcard" >
										 <span id="card" style="color:red"></span>
									</div>
								</div>
								<div class="real-name-con height-main margin-top-25 clearfix">
									<p class="content-left-zoon">
										 联系电话:
									</p>
									<div class="content-right-zoon">
										<input class="width-main input" type="text" datatype="*" name="saleMobile" value="${settle.saleMobile }"
										 id="saleMobile" >
										 <span id="mobile" style="color:red"></span>
										 
									</div>
								</div>
						   </div>
						
						
						<div class="unit-style padding-large-tb clearfix">
							<div class="margin-large-top padding-left text-left content-right-zoon">
							    <input style="display:none;" id="state" value="${settle.state}">
								<input type="submit" value="提交审核" class="submit fl" id="btnSettle" onclick="return subSettle()">
								<input type="submit" value="提交修改" class="submit fl" id="btnUpdate" onclick="return subUpdate()">
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
		

		<!-- 下拉功能 --> 
      <script>
			$(".sidebar-title").live('click', function() {
				if ($(this).parent(".sidebar-nav").hasClass("sidebar-nav-fold")) {
					$(this).next().slideDown(200);
					$(this).parent(".sidebar-nav").removeClass("sidebar-nav-fold");
				} else {
					$(this).next().slideUp(200);
					$(this).parent(".sidebar-nav").addClass("sidebar-nav-fold");
				}
			});
			
			$(document).ready(function(){
				var state=document.getElementById("state").value;
				
				if(state=="1"){
					$("#btnSettle").hide();	
					$("#btnUpdate").hide();
				}else if(state=="0"||state=="2"){
					$("#btnSettle").hide();
					$("#btnUpdate").show();
					}else{
						$("#btnSettle").show();
						$("#btnUpdate").hide();
					}	
				
			});
			
			var id=document.getElementById("id").value;
			
			//提交审核信息判断
			 function subSettle(){
				 for(var i=1;i<document.myform.elements.length-3;i++){
					 if(document.myform.elements[i].value==""){
						 alert("有信息未填完成！");
						 return false;
					 }
				 }
				 var cardType=$("#cardType").val();
				 var district=$("#district").val();
				 var saleType=$("#saleType").val();
				 var storeName=$("#storeName").val();
				 var saleName=$("#saleName").val();
				 if(cardType.length>20){
					 alert("证件长度超长！")
					 return false;
				 }
				 if(district.length>50){
					 alert("地址长度超长！")
					 return false;
				 }
				 if(saleType.length>50){
					 alert("经营范围长度超长！")
					 return false;
				 }
				 if(storeName.length>20){
					 alert("店铺名称超长！")
					 return false;
				 }
				 if(saleName.length>20){
					 alert("商家名称超长！")
					 return false;
				 }
				 return true;
			 }
			//修改信息判断
			function subUpdate(){
				for(var i=1;i<document.myform.elements.length-3;i++){
					 if(document.myform.elements[i].value==""){
						 alert("有信息未填完成！");
						 return false;
					 }
				 }
				 var cardType=$("#cardType").val();
				 var district=$("#district").val();
				 var saleType=$("#saleType").val();
				 var storeName=$("#storeName").val();
				 var saleName=$("#saleName").val();
				 if(cardType.length>20){
					 alert("证件长度超长！")
					 return false;
				 }
				 if(district.length>50){
					 alert("地址长度超长！")
					 return false;
				 }
				 if(saleType.length>50){
					 alert("经营范围长度超长！")
					 return false;
				 }
				 if(storeName.length>20){
					 alert("店铺名称超长！")
					 return false;
				 }
				 if(saleName.length>20){
					 alert("商家名称超长！")
					 return false;
				 }
				return true;
			}
		
			//提交申请信息
			 function formsub(){
				    var id=$("#id").val();
					var cardType=$("#cardType").val();
					var district=$("#district").val();
					var saleType=$("#saleType").val();
					var storeName=$("#storeName").val();
					var saleName=$("#saleName").val();
					var saleIdcard=$("#saleIdcard").val();
					var saleMobile=$("#saleMobile").val();
					var state=$("#state").val();
					$.ajax({
						data:{
							"id":id,
							"cardType":cardType,
							"district":district,
							"saleType":saleType,
							"storeName":storeName,
							"saleName":saleName,
							"saleIdcard":saleIdcard,
							"saleMobile":saleMobile,
							"state":state
						},
					    type:"POST",
					    dataType:"json",
					    url:"../sale/settle" ,  
					     async:false,  
					    success:function(data){
					    	alert("已提交！");
					    	window.location.href="${pageContext.request.contextPath }/sale/infoShow";	
					    },
						error:function(data){
					    	alert("提交失败！");
					    } 
					});
				}
			
			//电话校验
				var saleMobile=$("#saleMobile");
				
				saleMobile.blur(function(){
					var saleMobileVal=$("#saleMobile").val();
					var mobile=$("#mobile");
					if(saleMobileVal.length<11){
						mobile.html("电话号码格式错误，小于11位").css({color:"red"});
						saleMobile.focus();
					}else{
						if(saleMobileVal.length>11){
							mobile.html("电话号码格式错误，大于11位").css({color:"red"});
							saleMobile.focus();
						}else
						   mobile.html("ok").css({color:"blue"});
					}
				});
				
				//身份证号码校验
				var saleIdcard=$("#saleIdcard");
				saleIdcard.blur(function(){
					var card=$("#card");
					var saleIdcardVal=$("#saleIdcard").val();
					if(saleIdcardVal.length<18){
						card.html("身份证号格式错误，小于18位").css({color:"red"});
						saleIdcard.focus();
					}else{
						if(saleIdcardVal.length>18){
							card.html("身份证号格式错误，大于18位").css({color:"red"});
						}else card.html("ok").css({color:"blue"});
						
					}
				});


		</script>	
</body>
</html>


